home *** CD-ROM | disk | FTP | other *** search
-
- Fixing a Bug in the AT's ROM BIOS
-
- Michael J. Markowitz
- Department of Math. Sciences
- Loyola Univ. of Chicago
- Chicago, IL 60615
- (312) 508-3567
-
- After installing an 18MHz crystal in my AT, it scored between 8.4 and 9.4
- on Peter Norton's SYSINFO (SI) benchmark, i.e., it clocked in at roughly
- 8.5 times the speed of an IBM PC. That's 50% faster than a standard
- factory-shipped AT! But I had one problem--approximately 1 out of every
- 10 floppy disk accesses would result in a "Disk Read Error" and I'd see
- the familiar "Abort, Retry, Ignore?" prompt. While the retry option
- always worked, the interruption of long batch commands began to drive me
- crazy. (I had had absolutely no trouble with the floppy drive prior to
- installing the new crystal.)
-
- Checking with a friend at a major software house, I found that this
- problem is quite common in speeded-up AT's and that most users have just
- learned to live with it. I considered reinstalling the original crys-
- tal, but having become accustomed to "real" speed, could not quite bring
- myself to do it. So suspecting that the problem was in the software--
- not the hardware--I began poking around in the ROM BIOS listing in the
- Technical Reference Manual and found what I believe is the cause of the
- errors.
-
- In the handling of disk I/O requests, the INT 13h service routine goes
- into several timing loops while waiting for a response from the NEC
- floppy disk controller. If the NEC fails to respond (via a hardware
- interrupt) within a certain time period, the routine "times out" and
- returns an error code. One of these loops (in the WAIT_INT routine)
- repeats at most 256K times and would require 25 clock cycles per iter-
- ation if executed on an Intel 8088. On an IBM PC running at 4.77 MHz,
- where each clock cycle takes 210 nanoseconds, this would represent a
- maximum delay of 2.09 seconds. A comment in the AT ROM BIOS states that
- this loop provides a delay of 2 seconds. It seems that the folks at IBM
- forgot that they were writing code for an 80286 running at 6MHz!
-
- Although incorrectly coded, this timing loop seems barely adequate for
- the proper functioning of a standard AT. Install a faster crystal,
- however, and it executes much more quickly, providing a delay which
- is often too short for the detection of a response from the (inde-
- pendently clocked) floppy disk controller.
-
- It seemed to me that the simplest solution was to write a short routine
- which attaches itself permanently to DOS and intercepts all disk I/O
- requests through INT 13h (SEE *). When activated, this routine simulates the
- original software interrupt, then checks to see if the BIOS routine has
- returned an error code. If so, and it's a timeout error, the INT 13h (SEE *)
- request is repeated, otherwise control returns to the caller. By the
- second request the NEC controller should have issued the expected ack-
- nowledgement.
-
- Placing FIXDSK in your autoexec.bat file should completely eliminate
- disk access errors. It has been tested and found to work on three
- different AT's, with their original ROMs and crystals ranging in speed
- from 16 to 18MHz. It has not been tested with the BIOS in the new 30MB
- AT.
-
- * NOTE: FIXDSK.ASM modified 12/22/85 by C. Washburn to use INT 40H instead of
- 13H, and to restore contents of AH when retrying. INT 40H change was based
- the notion that NOTHING should get in the Fixed Disk INT 13H code path if
- at all possible! INT 40H is the relocated address of the BIOS Diskette code,
- after the Fixed Disk Controller ROM installs itself, and is only and exclu-
- sively for Floppy I/O.
-